cmake_minimum_required(VERSION 2.8)
project(proto_selt)

add_compile_options(-std=c++11)
add_compile_options(-pthread)

file(GLOB_RECURSE SOURCE_FILES src/*.cpp)
file(GLOB_RECURSE HEADER_FILES include/*.h)

include_directories(
    ${CMAKE_CURRENT_LIST_DIR}/../${PROJECT_NAME}/include    
)

add_library(${PROJECT_NAME}
	cpp/addressbook.pb.cc
	${HEADER_FILES}
	)

add_executable(${PROJECT_NAME}1
  cpp/list_people.cc
  ${HEADER_FILES}
)

add_executable(${PROJECT_NAME}2
  cpp/add_person.cc
  ${HEADER_FILES}
)


target_link_libraries(${PROJECT_NAME}1
    ${PROJECT_NAME}
    protobuf
)
target_link_libraries(${PROJECT_NAME}2
    ${PROJECT_NAME}
    protobuf
)

install(TARGETS ${PROJECT_NAME}1 ${PROJECT_NAME}2 ${PROJECT_NAME}
        DESTINATION lib
        )
install(DIRECTORY include/
        DESTINATION include)